<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<meta charset="utf-8">
<head th:include="@{include} :: header"></head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">
        <div class="layui-row">
            <form class="layui-form layui-form-pane" id="signupForm">
                <input id="id" name="id" th:value="${device.id}" type="hidden" />
                <input id="isSelf" name="isSelf" th:value="${device.isSelf}" type="hidden" />

                <div class="layui-form-item">
                    <label class="layui-form-label">设备名称</label>
                    <div class="layui-input-block">
                        <input id="deviceName" name="deviceName" th:value="${device.deviceName}" class="layui-input" type="text">
                    </div>
                </div>

<!--                <div class="layui-form-item">-->
<!--                    <label class="layui-form-label">设备编码</label>-->
<!--                    <div class="layui-input-block">-->
<!--                        <input id="deviceNum" name="deviceNum" th:value="${device.deviceNum}" class="layui-input" type="text" />-->
<!--                    </div>-->
<!--                </div>-->


                <div class="layui-form-item" th:if="${device.isSelf == 0}">
                    <label class="layui-form-label">所属企业</label>
                    <div class="layui-input-block">
                        <select name="shopId" id="shopId" lay-search="">
                            <option value="">所属企业</option>
                            <th:block th:each="d : ${companies}">
                                <option th:value="${d.id}" th:text="${d.shopName}" th:selected="${device.shopId == d.id}"></option>
                            </th:block>
                        </select>
                    </div>
                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label">焊机类型：</label>
                    <div class="layui-input-block">
                        <select id="deviceType" name="deviceType" class="layui-input" >
                            <option value="0" th:selected="${device.deviceType == 0}">普通式</option>
                            <option value="1" th:selected="${device.deviceType == 1}">等离子式</option>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">安全类型：</label>
                    <div class="layui-input-block">
                        <select id="isSafe" name="isSafe" class="layui-input" >
                            <option value="0" th:selected="${device.isSafe == 0}">非固定式</option>
                            <option value="1" th:selected="${device.isSafe == 1}">固定安全位置</option>
                        </select>
                    </div>
                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label">智能设备：</label>
                    <div class="layui-input-block">
                        <select id="isHasBreaker" name="isHasBreaker" class="layui-input" lay-filter="isHasBreaker">
                            <option value="0" th:selected="${device.isHasBreaker == 0}">无智能设备</option>
                            <option value="1" th:selected="${device.isHasBreaker == 1}">含有智能设备</option>
                        </select>
                    </div>
                </div>

                <div id="divFsrBreakerId" class="layui-form-item" th:classappend="${device.isHasBreaker == 1 ? '' : 'layui-hide'}">
                    <label class="layui-form-label">智能设备</label>
                    <div class="layui-input-block">
                        <select name="fsrBreakerId" id="fsrBreakerId" lay-search="">
                            <option value="">请选择智能设备</option>
                            <th:block th:each="d : ${fsrDevices}">
                                <option th:value="${d.id}" th:text="${d.name + '('+ d.fsrAssets.fsrAssetName + ' - ' +d.id+')' + (d.deviceId > 0 ? '(有设备绑定)' : '')}" th:selected="${device.fsrBreakerId == d.id}"></option>
<!--                                <option th:value="${d.id}" th:text="${d.name + d.deviceId}" th:selected="${device.fsrBreakerId == d.id}"></option>-->
                            </th:block>
                        </select>
                    </div>
                </div>



                <div class="layui-form-item">
                    <label class="layui-form-label">使用状态：</label>
                    <div class="layui-input-block">
                        <select id="useState" name="useState" class="layui-input">
                            <option value="0" th:selected="${device.useState == 0}">未使用</option>
                            <option value="1" th:selected="${device.useState == 1}">申请中</option>
                            <option value="2" th:selected="${device.useState == 2}">使用中</option>
                            <option value="3" th:selected="${device.useState == 3}">已断电</option>
                        </select>
                    </div>
                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label">所在省份</label>
                    <div class="layui-input-block">
                        <select name="provId" id="provId" lay-search="" lay-filter="provId">
                            <option value="">所在省份</option>
                            <th:block th:each="p : ${provinces}">
                                <option th:value="${p.id}" th:text="${p.provinceName}" th:selected="${device.provId == p.id}"></option>
                            </th:block>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item" >
                    <label class="layui-form-label">所在城市</label>
                    <div class="layui-input-block">
                        <select name="cityId" id="cityId" lay-search="">
                            <option value="">所在城市</option>
                            <th:block th:each="c : ${cityList}">
                                <option th:value="${c.id}" th:text="${c.cityName}" th:selected="${device.cityId == c.id}"></option>
                            </th:block>
                        </select>
                    </div>
                </div>


                <div class="layui-form-item" th:if="${device.isSelf == 1}">
                    <label class="layui-form-label">电焊工姓名</label>
                    <div class="layui-input-block">
                        <input id="leaderName" name="leaderName" th:value="${device.leaderName}" class="layui-input" type="text" />
                    </div>
                </div>

                <div class="layui-form-item" th:if="${device.isSelf == 1}">
                    <label class="layui-form-label">电焊工电话</label>
                    <div class="layui-input-block">
                        <input id="leaderPhone" name="leaderPhone" th:value="${device.leaderPhone}" class="layui-input" type="text" />
                    </div>
                </div>
                <div class="layui-form-item" th:if="${device.isSelf == 1}">
                    <label class="layui-form-label">电焊证编号</label>
                    <div class="layui-input-block">
                        <input id="certificateNum" name="certificateNum" th:value="${device.certificateNum}" class="layui-input" type="text" />
                    </div>
                </div>
                <div class="layui-form-item">
                    <div style="text-align: center;margin-top: 20px">
                        <button onclick="update()" class="layui-btn layui-btn-normal" >提交</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript" th:src="@{/js/appjs/module/device/welding/detail.js}"></script>
</body>
</html>
